import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName LC119
 * @Author ykx
 * @Date 2024/3/21 20:12
 * @Version 1.0
 */
public class LC119 {
    public List<Integer> getRow(int rowIndex) {
        List<List<Integer>> result = new ArrayList<>();
        for (int i = 1; i <= rowIndex + 1; i++) {
            List<Integer> integers = new ArrayList<>();
            for (int j = 1; j <= i; j++) {
                if (j == 1 || j == i) {
                    integers.add(1);
                } else {
                    integers.add(result.get(result.size() - 1).get(j - 1) + result.get(result.size() - 1).get(j - 2));
                }
            }
            result.add(integers);
        }
        return result.get(result.size() - 1);
    }
}
